package com.yjj.springboot3.ai.tools;

import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Component
public class DateTimeTools {
    @Tool(name = "getCurrentTime", description = "返回当前日期和时间，格式为YYYY-MM-DD HH:mm:ss")
    public String getCurrentTime() {
        String date = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        System.out.println("当前时间：" + date);
        return date;
    }
}
